#ifndef ALBERO_H_
#define ALBERO_H_

// #include <linux/fs.h>           /* everything... */
// #include <linux/cdev.h>

//#include "scull.h"              /* local definitions */


/*
  Tree:
    etichetta: stringa che contiene la parola
    contatore: numero di volte che è stata inserita la stringa
    figlio destro: puntatore ad un sottoalbero
    figlio sinistro: puntatore ad un sottoalbero
*/

typedef struct tree{
  char * string;
  int ric;
  struct tree *left;
  struct tree *right;
} tree;


//Funzioni di esplorazione:
void inorder (tree * t, char * buffer, unsigned long *lim, unsigned long *start);
int preorder (tree * t, char * buffer, unsigned long *lim, unsigned long *start);
void postorder (tree * t, char * buffer, unsigned long *lim, unsigned long *start);
void invorder (tree * t, char * buffer, unsigned long *lim, unsigned long *start);
void printMore (tree * t, int k, char * buffer, unsigned long *lim, unsigned long *start);
void printMoreDebug(tree * t, int k);
void tree_free(tree *t, int free_string);
void insert (tree *t, char str[]);
int isChar(char c);
tree * create(tree *, char*);
int writeString(char *, char *, unsigned long, unsigned long);
int copy_words(char *src, char *dst, int lim, tree *tr, char **start_at, int end);
#endif
